package elementui.script;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

public class ScriptContainer {

    StringBuffer container = new StringBuffer();
    String data;
    HashMap<String ,String> methods = new HashMap<String ,String>();
    HashMap<String ,String> mounteds = new HashMap<String ,String>();

    ArrayList<String> htmls = new ArrayList<>();

    public String getDefaultScriptContainer()
    {

        container.append("export default {");
        container.append(getData());
        container.append(",");
        container.append(" methods: {");
        for(String key:methods.keySet())
        {
            container.append(methods.get(key));
        }

        container.append(" },");
        container.append(" \n mounted() {");

        for(String key:mounteds.keySet())
        {
            container.append(mounteds.get(key));
        }

        //end mounted
        container.append("  }");
        // end all
        container.append("  }");


        return new String(container);

    }

    public void addMethod(String id,String method)
    {
        methods.put(id,method);
    }
    public void addMounted(String id,String mounted)
    {
        mounteds.put(id,mounted);
    }

public void addHtml(String html)
{
    htmls.add(html);
}



    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
